home *** CD-ROM | disk | FTP | other *** search
/ United Public Domain Gold 2 / United Public Domain Gold 2.iso / business / pb016.dms / pb016.adf / Config!P < prev    next >
Text File  |  1992-06-18  |  8KB  |  333 lines

  1. -----------------------------------------------------------------------------
  2. |                              Config!P                                        |
  3. |         Copyright (C) 1986-92 Rick Stiles.  All rights reserved.            |
  4. -----------------------------------------------------------------------------
  5.  
  6. *************************************
  7. N-variables used:
  8. n0-n6 scratch numbers
  9.  
  10. Buffers used:
  11. buf54 scratch buffer
  12.  
  13. *************************************
  14.  
  15. <defines:
  16. define(N_0,n0)
  17. define(N_1,n1)
  18. define(N_2,n2)
  19. define(N_3,n3)
  20. define(N_4,n4)
  21. define(N_5,n5)
  22. define(N_6,n6)
  23. define(B_4,buf54)
  24. >
  25.  
  26.  
  27. ======== PRINTER CMDS ========
  28.  
  29. Print the hilite region.  (See alt-p.)
  30. <ctl-p: print(curFile,hilite) >
  31.  
  32. Select printing port:  parallel, serial, Preferences raw or processed.
  33. <alt-p:
  34.     putMsg("Printer select: 0=par: 1=ser: 2=prt: 3=prt: (raw)")
  35.     getKeyVal(macroNum,inputChar)
  36.     sub(N_4,inputChar,"0")
  37.     if (geNum(N_4,0) & gtNum(4,N_4)) equateNum(prefPrint,N_4)
  38.     putMsg("") >
  39.  
  40. Print entire document
  41. <altCtl-p: print(curFile,all)>
  42.  
  43. Stop the current print
  44. <lAmiga-a: abortPrint abort>
  45.  
  46. Stop all prints that are stored up
  47. <rAmiga-a:
  48.     while (abortPrint) nothing
  49.     abort >
  50.  
  51. Restart current print
  52. <lAmiga-s: restartPrint>
  53.  
  54. Give printer control code help
  55. <shftAltCtl-p:
  56.     freebuf(B_4)
  57.     putMsg("")
  58.     insertRgn(B_4,sFile,
  59. "Press lAmiga-p and then one of the letters below.  For boldface, italics,
  60. 8 lines/inch, etc, the hilite region is bracketed with printer codes:
  61.  
  62. i = italics
  63. u = underline
  64. b = boldface
  65. c = condensed
  66. e = elite
  67. l = enlarged
  68. s = shadow
  69. d = double strike
  70. n = NLQ
  71. x = superscript
  72. y = subscript
  73. 8 = 8 lines/inch
  74.     Other keys:
  75.         rAmiga-g = find next printer code in document
  76.         lAmiga-g = input a printer code # (0-75.  See table in Manual.)
  77. \"Print select\" must be 2 or 3 for these codes to control your printer.
  78. Select \"Show vals\" to see what print-select is.  Select your printer in
  79. Preferences.
  80.  
  81. ",all)
  82.     flipFlag(B_4,readOnly)
  83.     equateNum(N_3,curFile)
  84.     editBuf(B_4)
  85.     vScroll(sFile)
  86.     updateDisplay
  87.     getKey(N_4)
  88.     editBuf(buf[N_3])
  89.     .. updateDisplay
  90.     freeBuf(B_4) >
  91.  
  92. Get a key and reduce it to lower case.
  93. <virtual-g:
  94.     putMsg("Enter prtr code (b c d e i l n s u x y 8 h=help):")
  95.     if (getKey(N_4)) { mod(N_4,N_4,104) putMsg("") returnTrue }
  96.     putMsg("")
  97.     returnFalse >
  98.  
  99. Bracket the hilite region with printer codes using N_4
  100. <virtual-c:
  101.     if (geLoc(curFile,sHilite,eHilite)) returnFalse
  102.     equateLoc(curFile,locA,atCursor)
  103.     moveCursor(curFile,sHilite)
  104.     .. the line below appears to be needed in some cases when the
  105.     .. code is embedded at start of line.  Without it the printer
  106.     .. may not receive the code.
  107.     if (is(curFile,sLine)) insertChar(curFile,13)
  108.     printerCode(curFile,N_3,0,0)
  109.     incNum(N_3)
  110.     moveCursor(curFile,eHilite)
  111.     printerCode(curFile,N_3,0,0)
  112.     equateLoc(curFile,eHilite,atCursor)
  113.     moveCursor(curFile,locA) >
  114.  
  115. Printer codes:  Next letter key brackets hilite for boldface, italics etc.
  116. <lAmiga-p:
  117.     if (runKey(virtual-g)) {
  118.         if (eqNum(N_4,normal-h)) runKey(shftAltCtl-p)
  119.         else {
  120.             switch (N_4) {
  121.                 case(normal-8) { equateNum(N_3,55) }
  122.                 case(normal-i) { equateNum(N_3,6) }
  123.                 case(normal-u) { equateNum(N_3,8) }
  124.                 case(normal-b) { equateNum(N_3,10) }
  125.                 case(normal-e) { equateNum(N_3,15) }
  126.                 case(normal-c) { equateNum(N_3,17) }
  127.                 case(normal-l) { equateNum(N_3,19) }
  128.                 case(normal-s) { equateNum(N_3,21) }
  129.                 case(normal-d) { equateNum(N_3,23) }
  130.                 case(normal-n) { equateNum(N_3,25) }
  131.                 case(normal-x) { equateNum(N_3,27) }
  132.                 case(normal-y) { equateNum(N_3,29) }
  133.                 default { returnFalse }
  134.             }
  135.             runKey(virtual-c)
  136.         }
  137.     } >
  138.  
  139. Find next printer code (can delete it with ctl-h)
  140. <rAmiga-g:
  141.     freeBuf(B_4)
  142.     insertChar(B_4,"")
  143.     insertChar(B_4,wildCard)
  144.     insertChar(B_4,"")
  145.     insertChar(B_4,eitherOr)
  146.     insertChar(B_4,"")
  147.     insertChar(B_4,wildCard)
  148.     insertChar(B_4,wildCard)
  149.     insertChar(B_4,"")
  150.     setSearch(B_4)
  151.     if (search(curFile,sInvert,eInvert,1))
  152.     putMsg("Press ctl-i to delete the code") >
  153.  
  154. Insert printer code.  (See printer code table for meaning of numbers 0-75.)
  155. <lAmiga-g:
  156.     putMsg("Enter printer code (0-75, see printer-codes):")
  157.     equateNum(N_3,0)
  158.     equateNum(N_2,0)
  159.     if (inputNum(N_4) & geNum(N_4,0) & geNum(75,N_4)) {
  160.         switch(N_4) {
  161.             case(12) {
  162.                 putMsg("Enter foreground color (30-39)")
  163.                 goto label(2) }
  164.             case(13) {
  165.                 putMsg("Enter background color (40-49)")
  166.                 goto label(2) }
  167.             case(48) {
  168.                 putMsg("Enter proportional offset")
  169.                 goto label(2) }
  170.             case(57) {
  171.                 putMsg("Enter form length")
  172.                 goto label(2) }
  173.             case(58) {
  174.                 putMsg("Enter # lines to skip on perforation")
  175.                 goto label(2) }
  176.             case(64) {
  177.                 putMsg("Top/bottom margins, enter top margin")
  178.                 }
  179.             case(65) {
  180.                 putMsg("Left/right margins, enter left margin")
  181.                 }
  182.             case(75) {
  183.                 putMsg("Extended command - enter arg value")
  184.                 goto label(2) }
  185.             default { goto label(1) }
  186.         }
  187. label(3)
  188.         if (not inputNum(N_2)) return
  189.         putMsg("Enter next value")
  190. label(2)
  191.         if (not inputNum(N_3)) return
  192. label(1)
  193.         printerCode(curFile,N_4,N_2,N_3)
  194.     } >
  195.  
  196. ======== PAGING CMDS ======
  197.  
  198. Erase next page number
  199. <lAmiga-y:
  200.     if (not is(curFile,eForm)) movecursor(curFile,eForm)
  201.     if (is(curFile,12)) return
  202.     if (not is(curFile,eLine)) moveCursor(curFile,eLine)
  203.     if (is(curFile,12)) runKey(alt-kp7)
  204. >
  205.  
  206. Input page number to go to
  207. <alt-3:
  208.     putMsg("Go to page #:")
  209.     if (inputNum(N_0)) gotoPage(curFile,N_0) >
  210.  
  211. Insert a formfeed character
  212. <lAmiga-f: insertChar(curFile,12) >
  213.  
  214. Go to top of page
  215. <lAmiga-h: moveCursor(curFile,sForm) >
  216.  
  217. Go to end of page
  218. <lAmiga-b: moveCursor(curFile,eForm) >
  219.  
  220. Insert page-division at cursor
  221. <lAmiga-v:
  222.     if (not is(curFile,sLine)) moveCursor(curFile,sLine)
  223.     getPageRowCol(N_0,N_1,N_2)
  224.     getLocal(curFile,N_3,bottomMargin)
  225.     getLocal(curFile,N_6,pageLines)
  226.     if (gtNum(2,N_6)) {
  227.         putMsg("Must set lines/page > 1 first")
  228.         returnFalse
  229.     }
  230.     div(N_3,N_3,2)
  231.     add(N_1,N_1,N_3)
  232.     while (gtNum(N_6,N_1)) { incNum(N_1) insertChar(curFile,eLine) }
  233.     getLocal(curFile,N_6,lineLength)
  234.     div(N_6,N_6,2)
  235.     while (gtNum(N_6,0)) { insertChar(curFile," ") decNum(N_6) }
  236.     toWord(curFile,N_0)
  237.     insertChar(curFile,12)
  238.     if (not is(curFile,eFile)) {
  239.         getLocal(curFile,N_4,topMargin)
  240.         while (gtNum(N_4,0)) { decNum(N_4) insertChar(curFile,eLine) }
  241.     }
  242. >
  243.  
  244. Delete next page-division
  245. <lAmiga-d:
  246. label(1)
  247.     if (not is(curFile,sForm)) moveCursor(curFile,sForm)
  248.     if (not is(curFile,eForm)) moveCursor(curFile,eForm)
  249.     if (not is(curFile,eLine)) moveCursor(curFile,eline)
  250.     if (not is(curFile,12)) {
  251.         moveCursor(curFile,eChar)
  252.         if (not is(curFile,eFile)) goto label(1)
  253.         returnFalse
  254.     }
  255.     if (not is(curFile,sLine)) moveCursor(curFile,sLine)
  256.     getPageRowCol(N_6,N_0,N_1)
  257.     getLocal(curFile,N_4,topMargin)
  258.     getLocal(curFile,N_3,bottomMargin)
  259.     equateLoc(curFile,locA,atCursor)                      .. start of ff line
  260.     moveCursor(curFile,downLine)
  261.     while (gtNum(N_4,0)) {                                    .. del tm lines
  262.         if (not is(curFile,blankLine)) goto label(2)
  263.         decNum(N_4)
  264.         moveCursor(curFile,downLine)
  265.     }
  266. label(2)
  267.     equateLoc(curFile,locB,atCursor)
  268.     equateLoc(curFile,atCursor,locA)
  269.     moveCursor(curFile,upLine)
  270.     while (gtNum(N_0,0)) {
  271.         decNum(N_0)
  272.         if (not is(curFile,blankLine)) {
  273.             moveCursor(curFile,downLine)
  274.             goto label(3)
  275.         }
  276.         moveCursor(curFile,upLine)
  277.     }
  278. label(3)
  279.     equateLoc(curFile,locA,atCursor)
  280.     clearRgn(curFile,loc) >
  281.  
  282. Auto-insert page-divisions and page-numbers in document
  283. <lAmiga-r:
  284.     putMsg("Scanning")
  285.     equateLoc(curFile,locA,atCursor)
  286.     freeBuf(B_4)
  287.     insertChar(B_4,12)
  288.     setSearch(B_4)
  289.     if (search(curFile,sInvert,eInvert,1)) {
  290.         putMsg("Delete old paging divisions first using lAmiga-d")
  291.         returnFalse
  292.     }
  293.     putMsg("")
  294.     equateLoc(curFile,atCursor,locA)
  295.     if (not is(curFile,sForm)) moveCursor(curFile,sForm)
  296.     while (nothing) {
  297.         moveCursor(curFile,eForm)
  298.         getLocal(curFile,N_3,bottomMargin)
  299.         getPageRowCol(N_0,N_1,N_2)
  300.         getLocal(curFile,N_2,pageLines)
  301.         if (gtNum(2,N_2)) {
  302.             putMsg("Must set lines/page > 1 first")
  303.             returnFalse
  304.         }
  305.         if (gtNum(N_2,N_1)) {                            .. last page is short
  306.             sub(N_5,N_2,N_1)                        .. page lines - real line
  307.             while (gtNum(N_2,N_1)) {
  308.                 insertChar(curFile,eLine)
  309.                 incNum(N_1)
  310.             }
  311.             do (N_4,1,N_3)  moveCursor(curFile,upLine)
  312.             runKey(lAmiga-v)
  313.             if (not is(curFile,eFile)) {
  314.                 moveCursor(curFile,eFile)
  315.                 runKey(lAmiga-v)
  316.             }
  317.             return
  318.         }
  319.         do (N_4,1,N_3)  moveCursor(curFile,upLine)
  320.         equateNum(N_4,1)
  321.         while (is(curFile,blankLine)) {
  322.             moveCursor(curFile,downLine)
  323.             incNum(N_4)
  324.             if (geNum(N_4,N_3)) goto label(1)
  325.         }
  326.         label(1)
  327.         runKey(lAmiga-v)
  328.         moveCursor(curFile,downLine)
  329.         updateDisplay
  330.     } >
  331.  
  332. <defines: >
  333.